const mongoose = require('mongoose')

// 收获地址的设计
const Address = new mongoose.Schema({
  // 用户id
  uid: {
    type: mongoose.ObjectId,
    required: true
  },
  // 收件人姓名
  name: {
    type: String,
    require: true
  },
  // 收件人联系方式
  tel: {
    type: String,
    required: true
  },
  // 详细地址
  detailed: {
    type: String,
    require: true
  },
  // 邮编
  code: {
    type: String,
    default: '000000'
  },
  // 是否默认
  isDefault: Boolean
})

module.exports = mongoose.model('address', Address)
